//
//  YOSearchBar.m
//  YOSearchBar
//
//  Created by yutenys on 16/7/28.
//  Copyright © 2016年 yutenys. All rights reserved.
//

#import "YOSearchBar.h"

@interface YOSearchBar ()<UITextFieldDelegate>
@property(nonatomic,strong)UIView *intputView;

@end

@implementation YOSearchBar

-(instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self)
    {
        
        self.borderStyle = UITextBorderStyleRoundedRect;
        //设置输入框内容的字体样式和大小
        self.font = [UIFont fontWithName:@"Arial" size:11.0f];
//        self.textColor  = [UIColor redColor];
//        self.layer.cornerRadius = 14 * FitH;
//        self.layer.borderWidth = 1.0;
        self.layer.borderColor = [UIColor colorWithHexString:@"f5f5f5"].CGColor;
        self.attributedPlaceholder = [[NSAttributedString alloc] initWithString:@"  搜索你想要的商品" attributes:@{NSForegroundColorAttributeName: [UIColor colorWithHexString:@"999999"],NSFontAttributeName:[UIFont systemFontOfSize:11]}];

        
        self.intputView = [[UIView alloc] init];
        self.intputView.backgroundColor = [UIColor clearColor];
        self.intputView.frame= CGRectMake(0, 0 ,30  , 30);

        self.imgSearch = [[UIImageView alloc] init];
        self.imgSearch.backgroundColor = [UIColor clearColor];
        self.imgSearch.image = [UIImage imageNamed:@"search.png"];
        CGRect rx = CGRectMake( 0,8 , 16, 16);
        self.imgSearch.frame = rx;
        
        [self.intputView addSubview:self.imgSearch];
        // 把leftVw设置给文本框
        self.rightView = self.intputView;
        self.rightViewMode = UITextFieldViewModeAlways;
        self.delegate = self;
      self.backgroundColor = [UIColor clearColor];
    }
    return self;
}




@end
